﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    评论
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table>
        <%foreach (var item in (IList<XianboSite.Models.UserComment>)ViewData["comment"])
          {%>
        <tr>
            <td>
                <%=Html.Label(item.Content) %>
            </td>
        </tr>
        <%} %>
    </table>
    <div id="content">
    </div>
    <div>
        <input type="button" onclick="addComment('<%=ViewData["liveid"]%>');" value="提交" />
    </div>
    <script type="text/javascript">
<!--
        CKEDITOR.replace("content",
      {
          skin: "kama", width: 1000, height: 100
      });
//-->
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="script_css" runat="server">
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/bar.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/default.css" rel="stylesheet" />
    <script src="../../Scripts/ckeditor.js" type="text/javascript"></script>
    <script src="../../Scripts/artDialog.js" type="text/javascript"></script>
    <script type="text/javascript">
        function addComment(liveid) {
            var content = CKEDITOR.instances.content.getData();
            var request = createRequest();
            var url = "Comment/Add";
            try {
                request.open("POST", url, true);
                request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                request.onreadystatechange = function () {
                    if (request.readyState == 4) {
                        if (request.status == 200) {
                            // 成功后弹出提示框
                            art.dialog({
                                title: '添加关注',
                                content: '添加关注成功！', //点击<a href="User">此处</a>跳转到用户页查看关注。
                                width: 360,
                                fixed: true,
                                lock: true,
                                okValue: '关闭',
                                ok: function () {
                                }
                            });
                        }
                    }
                    return null;
                };
                request.send("liveid=" + liveid + "&content=" + content);
            }
            catch (e) { }
        }

        function createRequest() {
            var xmlHttp = null;
            try {
                // 首先尝试遗留对象
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    // 现在尝试ie实现
                    this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (E) {
                    xmlHttp = false;
                }
            }
            if (!xmlHttp && typeof XMLHttpRequest != "undefined") {
                // 因为我们必须使用基于mozilla的浏览器，所以现在创建一个本地请求对象
                xmlHttp = new XMLHttpRequest();
            }
            return xmlHttp;
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="loginHolder" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="categories" runat="server">
</asp:Content>
